package com.sam.im.heiqun.uis.adapters.holder;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sam.im.heiqun.R;
import com.sam.im.heiqun.uis.adapters.NewFriendAdpter;

/**
 * Created by Joe on 2016/12/20.
 */

public class NewFriendHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
    public final View mView;
    public final ImageView head_image;
    public final TextView nick;
    public final TextView content;
    public final TextView agree;
    public final TextView unagree;
    private NewFriendAdpter.NewFriendListClickListener mNewFriendListClickListener;

    public NewFriendHolder(View view, NewFriendAdpter.NewFriendListClickListener newFriendListClickListener) {
        super(view);
        mView = view;
        this.mNewFriendListClickListener =newFriendListClickListener;
        head_image = (ImageView) view.findViewById(R.id.head_image);
        nick = (TextView) view.findViewById(R.id.nick);
        content = (TextView) view.findViewById(R.id.content);
        agree = (TextView) view.findViewById(R.id.agree);
        unagree = (TextView) view.findViewById(R.id.unagree);

        agree.setOnClickListener(this);
        mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mNewFriendListClickListener!=null)
                {
                    mNewFriendListClickListener.onAgreeNewFriendClick(view,getAdapterPosition(),0);
                }
            }
        });
    }

    @Override
    public void onClick(View v) {
        if (mNewFriendListClickListener!=null)
        {
            mNewFriendListClickListener.onAgreeNewFriendClick(v,getAdapterPosition(),1);
        }
    }
}